import { getEnum } from '@/utils/enumUtils'


// 自定义指令-数据字典
export default {
    mounted(el, binding) {
        const _innerText = el.innerText
        const {value: dic} = binding
        if (!dic) return
        getEnum(dic, (res) => {
            if (!res[dic]) return
            const matchingItem = res[dic].find(item => item.value.toString() === _innerText.toString())
            el.innerText = matchingItem ? matchingItem.label : _innerText
        })
    }
}